package com.aaron.study;


import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;

/**
 * @author liurong
 * @date 2021/9/5 15:29
 * @version:
 */
public class HashSetAddDemo {


    public static void main(String[] args) {
        //创建HashSet
        HashSet<String> set = new HashSet<>();
        //HashSet中添加元素
        set.add("张三");
        set.add("李四");
        set.add("王五");
        set.contains("xx");
        set.size();
        new Object();

        for (String s : set) {
            System.out.println(s);
        }

        System.out.println("+++++++++++++++++++++++++++");

        Iterator<String> iterator = set.iterator();
        while (iterator.hasNext()) {
            System.out.println(iterator.next());
        }

    }


}

